home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 8137 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.5 KB

  1. Path: news.microsoft.com!news
  2. From: a-cnadc@microsoft.com (Dann Corbit)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: No struct in C++!!?
  5. Date: 15 Feb 1996 01:38:38 GMT
  6. Organization: Microsoft Corporation
  7. Message-ID: <4fu2qu$15g@news.microsoft.com>
  8. References: <1996Feb14.151620.5532@queens-belfast.ac.uk>
  9. NNTP-Posting-Host: 157.57.171.202
  10. Mime-Version: 1.0
  11. X-Newsreader: WinVN 0.93.14
  12.  
  13. In article <1996Feb14.151620.5532@queens-belfast.ac.uk>, gbw@harrier.am.qub.ac.uk says...
  14. >
  15. >Hi,
  16. >
  17. >a beginners question: I found in different C++ books examples of C++ programms
  18. >which contain type declarations and definitions in the main() programm - for
  19. >example a struct  - as in C.
  20. >My question is, whether this is a contradiction 
  21. >to the paradigm of C++. Shouldn't be everything in a C++ programm
  22. >either classes, objects or the interaction between objects?
  23. >So is it bad C++ style, to use functions or data outside from
  24. >classes (objects)?
  25. >
  26. >Thanks!
  27. >
  28. >Georg Woeste
  29. C++ is (for the most part) a superset of C.  That means that you
  30. don't have to write object oriented code if you don't want to.
  31. You can use it as "a better C" if you like.  Even in C++ not all
  32. data items are objects in well written object oriented code.
  33. Consider primitive data types like "double".  We don't say:
  34.  
  35.     double dNum = 5.
  36.         double dAns;
  37.     dAns.exp(5);
  38.  
  39. To find the exponential of five, instead we just:
  40.  
  41.     double dNum = 5.
  42.         double dAns;
  43.     dAns = exp(5);
  44.  
  45. -- 
  46. The opinions expressed in this message are my own personal views 
  47. and do not reflect the official views of Microsoft Corporation.
  48.  
  49.